package top.zhangjianyong.tools.service.mybatis.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.zhangjianyong.tools.entity.marirui.JJGZ;
import top.zhangjianyong.tools.mapper.JJGZMapper;
import top.zhangjianyong.tools.service.mybatis.IJJGZService;
import top.zhangjianyong.tools.utils.ApiResponse;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * @author ： zhangjianyong
 * @date ： 2022/10/14 9:41 AM
 */
@Service
public class IJJGZServiceImpl extends ServiceImpl<JJGZMapper, JJGZ> implements IJJGZService {

    @Override
    public JJGZ qryOneByDmAndGzDate(String dm, LocalDate gzDate) {
        return lambdaQuery()
                .eq(JJGZ::getDm, dm)
                .eq(JJGZ::getGzDate, gzDate)
                .one();
    }

    @Override
    public List<JJGZ> listByValueDate(LocalDate valueDate) {
        return lambdaQuery().eq(JJGZ::getGzDate, valueDate).list();
    }

    @Override
    public List<JJGZ> qryByDm(String dm) {
        return lambdaQuery().eq(JJGZ::getDm, dm).gt(JJGZ::getGz, BigDecimal.ZERO).list();
    }
}
